package cn.wolfcode.qo;

import cn.hutool.core.date.DateUtil;
import cn.wolfcode.domain.Employee;
import cn.wolfcode.util.UserContext;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Getter
@Setter
public class NoticeObject extends QueryObject {
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date minTime;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date maxTime;
    private Integer level;
    private Integer readStatus;
    private Integer publishStatus;
    private Employee employee = UserContext.getCurrentEmployee();

    //防止查询最后一天没有被查询到
    //2020-3-1 00   2020-3-1 23:59:59
    public Date getMaxTime(){
        if (maxTime == null){
            return null;
        }
        return DateUtil.endOfDay(maxTime);
    }
}
